package com.bling.common.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 地区信息
 * @author BLingSoft
 *
 */
@Entity
@Table(name="T_AREA")
public class Area implements Serializable{

	private static final long serialVersionUID = -1095372508888525960L;

	private Integer id;//地区编号
	private Integer parentid;//上级地区编号
	private String name;//地区名称
	private Integer sort;//排序
	
	private Area parentarea;
	private List<Area> childarea = new ArrayList<Area>();
	
	public Area() {
		super();
	}

	public Area(Integer parentid, String name, Integer sort) {
		super();
		this.parentid = parentid;
		this.name = name;
		this.sort = sort;
	}

	@Id
	@GeneratedValue
	@Column
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column
	public Integer getParentid() {
		return parentid;
	}

	public void setParentid(Integer parentid) {
		this.parentid = parentid;
	}

	@Column(length=50)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Column
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	@Transient
	public Area getParentarea() {
		return parentarea;
	}

	public void setParentarea(Area parentarea) {
		this.parentarea = parentarea;
	}

	@Transient
	public List<Area> getChildarea() {
		return childarea;
	}

	public void setChildarea(List<Area> childarea) {
		this.childarea = childarea;
	}
}
